<?php
namespace app\admin\controller;


use think\Controller;
use think\Db;
Class Linkage extends Controller{
    public function index(){
        $province = input('name');
        $city = input('city');
        if(!empty($province)){
            $value = Db::name('city')
                ->where('province_id',$province)
                ->select();
            $dist = Db::name('district')
                ->where('city_id',$value[0]['city_id'])
                ->select();
            $result = [$value,$dist];
            return json($result);

        }
        if(!empty($city)){
            $values = Db ::name('district')->where('city_id',$city)->select();
            return json($values);
        }
    }
}

?>